﻿'Clinciu Andrei
Option Strict On

Imports System.Collections.Generic
Imports System.Data.OleDb

Public Class PaymentType
    Private _name As String
    Private _id As Integer

    Public Sub New(ByVal id As Integer, ByVal name As String)
        _id = id
        _name = name

    End Sub

    Public ReadOnly Property Id As Integer
        Get
            Return _id
        End Get
    End Property
    Public ReadOnly Property Name As String
        Get
            Return _name
        End Get
    End Property

    Public Shared Function GetAllPaymentTypes(ByRef dbh As DatabaseHelper) As List(Of PaymentType)
        Dim theList As New List(Of PaymentType)
        Dim reader As OleDbDataReader = dbh.GetReader("SELECT * FROM prmBetaalType", {})

        Do While reader.Read()
            theList.Add(New PaymentType(CInt(reader("BetaalTypeId")), CStr(reader("BetaalTypeNaam"))))
        Loop

        Return theList
    End Function

    Public Overrides Function toString() As String
        Return _name
    End Function
End Class
